/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.SCADA.impl;

import EA_Model.IEC61970.Core.impl.PowerSystemResourceImpl;

import EA_Model.IEC61970.SCADA.RemoteUnit;
import EA_Model.IEC61970.SCADA.RemoteUnitType;
import EA_Model.IEC61970.SCADA.SCADAPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Remote Unit</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.SCADA.impl.RemoteUnitImpl#getRemoteUnitType <em>Remote Unit Type</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RemoteUnitImpl extends PowerSystemResourceImpl implements RemoteUnit {
	/**
	 * The default value of the '{@link #getRemoteUnitType() <em>Remote Unit Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRemoteUnitType()
	 * @generated
	 * @ordered
	 */
	protected static final RemoteUnitType REMOTE_UNIT_TYPE_EDEFAULT = RemoteUnitType.RTU;

	/**
	 * The cached value of the '{@link #getRemoteUnitType() <em>Remote Unit Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRemoteUnitType()
	 * @generated
	 * @ordered
	 */
	protected RemoteUnitType remoteUnitType = REMOTE_UNIT_TYPE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RemoteUnitImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return SCADAPackage.Literals.REMOTE_UNIT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RemoteUnitType getRemoteUnitType() {
		return remoteUnitType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRemoteUnitType(RemoteUnitType newRemoteUnitType) {
		RemoteUnitType oldRemoteUnitType = remoteUnitType;
		remoteUnitType = newRemoteUnitType == null ? REMOTE_UNIT_TYPE_EDEFAULT : newRemoteUnitType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SCADAPackage.REMOTE_UNIT__REMOTE_UNIT_TYPE, oldRemoteUnitType, remoteUnitType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case SCADAPackage.REMOTE_UNIT__REMOTE_UNIT_TYPE:
				return getRemoteUnitType();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case SCADAPackage.REMOTE_UNIT__REMOTE_UNIT_TYPE:
				setRemoteUnitType((RemoteUnitType)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case SCADAPackage.REMOTE_UNIT__REMOTE_UNIT_TYPE:
				setRemoteUnitType(REMOTE_UNIT_TYPE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case SCADAPackage.REMOTE_UNIT__REMOTE_UNIT_TYPE:
				return remoteUnitType != REMOTE_UNIT_TYPE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (remoteUnitType: ");
		result.append(remoteUnitType);
		result.append(')');
		return result.toString();
	}

} //RemoteUnitImpl
